package com.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.pojo.Category;
import com.pojo.Product;
import com.utils.JDBCDBCPUtils;

public class CategoryDao {
	QueryRunner qr=new QueryRunner(JDBCDBCPUtils.getDataSource());

	public List<Category> findAll(){
		String sql="select *from category ";
		List<Category> list =null;
		try {
		list = qr.query(sql, new BeanListHandler<Category>(Category.class));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return  list;
	}
}
